package com.film.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.film.domain.Performer;
import com.film.service.PerformerService;
import com.film.service.impl.PerformerServiceImpl;

@WebServlet("/filmPerformer.do")
public class PerformerController extends HttpServlet{
	private PerformerService performerService = new PerformerServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//获取请求的参数
		String id = request.getParameter("perId");
		int perId = Integer.parseInt(id);
		//查询演员信息
		Performer performer = performerService.returnPerformerAndFilm(perId);
		
		//查询所有的演员信息
		List<Performer> performers = performerService.selectAllPerformer();
		request.setAttribute("performers", performers);
		request.setAttribute("performerOneInf",performer);
		request.getRequestDispatcher("filmPerformer.jsp").forward(request, response);
	}
}
